package com.spring.campus_express_delivery.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/*springboot找不到资源文件做的映射
 * 文件的配置类扫描到本地的d盘D:/restaurantRes/
 * */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");

        //windows本地文件目录1
           registry.addResourceHandler("/restaurantRes/**").addResourceLocations("file:C:/Users/Administrator/Desktop/restaurantRes/");

        //linux
        //registry.addResourceHandler("/static/restaurantRes/**").addResourceLocations("file:/root/restaurantRes/");

        super.addResourceHandlers(registry);
    }
}